package com.zzy.liteflow.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yomahub.liteflow.core.FlowExecutor;
import com.zzy.liteflow.common.TopNode;


@RequestMapping("/node")
@Controller
public class NodeController {
	
	@Resource
	FlowExecutor flowExecutor;
	
    @Autowired
    JdbcTemplate jdbcTemplate;
	
	
	@RequestMapping("/add")
	@ResponseBody
	public String add(HttpServletRequest request, TopNode topNode) {
		jdbcTemplate.execute(
				"INSERT INTO SCRIPT_NODE_TABLE (APPLICATION_NAME,SCRIPT_NODE_ID,SCRIPT_NODE_NAME,SCRIPT_NODE_TYPE,SCRIPT_NODE_DATA,SCRIPT_LANGUAGE) "
				+ "values ('demo','x3','x3脚本','script','defaultContext.setData(\"test\",\"hello\");','groovy');");		
		return "success";
	}

}
